<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;

class Classroom extends Model
{
    protected $table = 'classroom';

    public function scopeWhereId(Builder $builder,$id){
        return $builder->where('id',$id);
    }

    //查询店铺名
    public function store()
    {
        return $this->hasOne('App\Models\Store','id','store_id');
    }

    public function carousel_image()
    {
        return $this->hasMany('App\Models\CarouselImage','classroom_id','id');
    }

    public function getImageAttribute($value){
        return getDomain().'/'.$value;
    }

}
